package com.study.talk.module.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

/**
 * <p>
 * 
 * </p>
 *
 * @author thor
 * @since 2023-12-18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "Friend对象", description = "")
public class Friend implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("好友记录id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("用户id")
    private Integer userId;

    @ApiModelProperty("好友id")
    private Integer friendId;

    @ApiModelProperty("好友昵称")
    private String friendName;

    @ApiModelProperty("好友头像地址")
    private String friendAvatar;

    @ApiModelProperty("好友简介")
    private String friendIntroduce;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    public Friend(UserInfo friendInfo, Integer userId) {
        this.friendId = friendInfo.getId();
        this.friendAvatar = friendInfo.getAvatar();
        this.friendName = friendInfo.getNickName();
        this.friendIntroduce = friendInfo.getIntroduce();
        this.userId = userId;
    }
}
